package com.chixing.util;

public class ServerResult {
    private int code;
    private String reason;
    private Object data;

    // get、set
    // constructor

    public ServerResult() {
    }

    public ServerResult(int code, String reason, Object data) {
        this.code = code;
        this.reason = reason;
        this.data = data;
    }

    //查询成功
    public static ServerResult getSussess(Object data) {
        return new ServerResult(200,"查询数据成功",data);
    }

    //查询失败
    public static ServerResult getFail(Object data) {
        return new ServerResult(201,"查询数据失败",data);
    }

    //插入成功
    public static ServerResult saveSussess(Object data) {
        return new ServerResult(200,"插入数据成功",data);
    }

    public static ServerResult saveFail(Object data) {
        return new ServerResult(201,"插入数据失败",data);
    }

    //修改成功
    public static ServerResult updateSussess(Object data) {
        return new ServerResult(200,"修改数据成功",data);
    }

    public static ServerResult updateFail(Object data) {
        return new ServerResult(201,"修改数据失败",data);
    }

    //删除成功
    public static ServerResult deleteSussess(Object data) {
        return new ServerResult(200,"删除数据成功",data);
    }

    public static ServerResult deleteFail(Object data) {
        return new ServerResult(201,"删除数据失败",data);
    }

    public static ServerResult loginSuccess(Object data) {
        return new ServerResult(200,"登陆成功",data);
    }

    public static ServerResult loginFile(Object data) {
        return new ServerResult(201,"登陆失败",data);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

}
